import React, { Component, createRef } from 'react'


export default class App extends Component {
  divRef = React.createRef()

  state = {
    count:0
  };
  clickHandler = () => {
    this.setState(prevState => {
      return{
        count:prevState.count+1
      };
    })
    console.log(this.divRef);
  };

  render() {
    return (
      <div ref={this.divRef}>
        <button onClick={this.clickHandler}>点我</button>
        App
        <div>{this.state.count}</div>
      </div>
      
    )
  }
}
